function addParam(){
	var count = getParamCount()+1;//alert(count);
	setParamCount(count);
	
	//create select
	var paramSelect = document.createElement("select");
	paramSelect.setAttribute("name", "search-koperasi-select"+count);
	paramSelect.setAttribute("id", "search-koperasi-select"+count);
	paramSelect.setAttribute("class", "search-koperasi-select");
	
	var option;
	
	option = document.createElement("option");
	option.setAttribute("value", "NAMAKOPERASI");
	option.innerHTML = "Nama Koperasi";
	paramSelect.appendChild(option);
	
	option = document.createElement("option");
	option.setAttribute("value", "INFORMASI");
	option.innerHTML = "Info Koperasi";
	paramSelect.appendChild(option);
	
	option = document.createElement("option");
	option.setAttribute("value", "NAMAKOTA");
	option.innerHTML = "Kota Koperasi";
	paramSelect.appendChild(option);
	
	var br = document.createElement("br");
	br.setAttribute("id", "br-label"+count);
	document.getElementById('search-koperasi-label').appendChild(br);
	document.getElementById('search-koperasi-label').appendChild(paramSelect);
	
	//create textfield
	var paramText = document.createElement("input");
	paramText.setAttribute("type", "text");
	paramText.setAttribute("id", "search-koperasi-textfield"+count);
	paramText.setAttribute("name", "search-koperasi-textfield"+count);
	paramText.setAttribute("class", "search-koperasi-textfield");
	
	var br = document.createElement("br");
	br.setAttribute("id", "br-param"+count);
	document.getElementById('search-koperasi-param').appendChild(br);
	document.getElementById('search-koperasi-param').appendChild(paramText);
	
}

function getXMLHttp(){
	var xmlHttp = null;
	if(window.XMLHttpRequest) {		// for Forefox, IE7+, Opera, Safari, ...
		xmlHttp = new XMLHttpRequest(); 
	} else if(window.ActiveXObject) {	// for Internet Explorer 5 or 6
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	return xmlHttp;
}

function test(filename){
	var ajax = getXMLHttp();
	var params = getParams();
	ajax.onreadystatechange = function(){
		if(ajax.readyState == 4 && ajax.status==200){
			document.getElementById('right-section').innerHTML = ajax.responseText;
		} 
	}
	
	ajax.open("GET", filename+"?params="+params, true); 
	ajax.send();
}

function getParams(){
	var paramLength = getParamCount();
	var arr = "";
	for(var i=0; i<=paramLength; i++){
		var textParam = document.getElementById('search-koperasi-textfield'+i).value;
		if(textParam != "" && textParam != null){
			arr += document.getElementById('search-koperasi-select'+i).value;
			arr += "-";
			arr += textParam;
			arr += ",";
		}
		
	}
	
	return arr;
}

function setParamCount(count){
	paramCount = count;
}

function getParamCount(){
	return this.paramCount;
}


var paramCount = 0;